cmake_minimum_required(VERSION 3.10)
project(rewine)

set(REWINE_VERSION "0.0.1")

include(CMakeOptions.txt)

IF (TARGET_X64)
    message("compile for x64")
    set(ADDRESS_MODEL 64)
ELSE()
    message("compile for x86")
    set(ADDRESS_MODEL 32)
ENDIF()

set(CMAKE_C_COMPILER /usr/bin/gcc-9)
set(CMAKE_C_STANDARD 17)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -m${ADDRESS_MODEL}")

set(CMAKE_CXX_COMPILER /usr/bin/g++-9)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -m${ADDRESS_MODEL}")

IF (CMAKE_BUILD_TYPE STREQUAL Debug)
    add_definitions(-O0 -g -ggdb3)
ENDIF()

IF (CMAKE_BUILD_TYPE STREQUAL Release)
    add_definitions(-O2)
ENDIF()

find_package(spdlog REQUIRED PATHS /usr/local/lib/cmake)

add_subdirectory(src)
add_subdirectory(test)
